<?php

use console\services\MigrateService;
use yii\db\Migration;

/**
 * Handles the creation of table `sys_dict_type`.
 */
class m231229_144108_create_sys_dict_type_table extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->createTable('sys_dict_type', [
            'id' => $this->bigPrimaryKey(),
            'name' => $this->string(64)->defaultValue('')->notNull()->comment('字典名称'),
            'type' => $this->string(64)->defaultValue('')->notNull()->comment('字典类型'),
            'remark' => $this->string(255)->defaultValue('')->null()->comment('备注'),
            'create_time' => $this->bigInteger()->defaultValue(0)->null()->comment('创建时间'),
            'update_time' => $this->bigInteger()->defaultValue(0)->null()->comment('更新时间'),
        ], MigrateService::createTableOptions('字典类型表'));

        $this->batchInsert('sys_dict_type',
            ['id', 'name', 'type', 'remark', 'create_time', 'update_time'],
            [
                [1, '用户性别', 'sys_user_sex', '用户性别列表', 1732850585, 1732850585],
                [2, '显示隐藏', 'sys_show_hide', '菜单状态列表', 1732850585, 1732850585],
                [3, '正常停用', 'sys_normal_disable', '系统开关列表', 1732850585, 1732850585],
                [4, '成功失败', 'sys_common_status', '登录状态列表', 1732850585, 1732850585],
                [5, '系统是否', 'sys_yes_no', '是红，否蓝', 1732850585, 1732850585],
                [6, '系统是否', 'sys_no_yes', '否红，是蓝', 1732850585, 1732850585],
                [7, '通知类型', 'sys_notice_type', '通知类型列表', 1732850585, 1732850585],
                [8, '操作类型', 'sys_oper_type', '操作类型列表', 1732850585, 1732850585],
            ]
        );
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('sys_dict_type');
    }
}
